/*****************************************************************************
 *
 * Weber State University
 * CS4280 Spring 2010
 * Final Group Assignment
 *
 *
 *   TTTTTT                               CCCCC
 *     TT   EEEEE   A    M   M          CC      C
 *     TT   E      A A   M   M         CC   
 *     TT   E     A   A  MM MM  -----  CC
 *     TT   EEE   AAAAA  M M M  -----  CC
 *     TT   E     A   A  M   M          CC      C
 *     TT   EEEEE A   A  M   M            CCCCC
 *
 *   Jared Pack ---- Jon Mann ---- Joshua Clayton
 *
 *
 * 
 *
 ****************************************************************************/

 /* FILENAME player.cpp
  *
  * Change control Section
  *
  * Team Member: Jon Mann
  * Version: 0.1
  * Date: 04/9/2010
  *     Added FadeScreen(), Tick(), DrawLoser(), and DrawWinner() to set up
  *			losing when an enemy touches you
  *		Added code to Tick() to help force player and camera to stick together.
  *      
  * Team Member: Jon Mann
  * Version: 0.2
  * Date: 04/11/2010
  *     Added RackUpAnotherKill() and GetKillCount() to track kills
  *
  * Team Member: Jon Mann
  * Version: 0.3
  * Date: 04/13/2010
  *     Removed FadeScreen(), DrawLoser(), and DrawWinner()--reverted to old gui
  *		Added init(), killPlayer(), and isPlayerDead() to set up player and let 
  *			the game know if the player has been killed
  */

#include "player.h"
#include "gui.h"

// add to the kill count
void CPlayer::RackUpAnotherKill()
{
	kills++;
}

// access kill count
int CPlayer::GetKillCount()
{
	return kills;
}

// Phase 14 - Take out until Rocket is introduced
// Phase 16 - Uncomment
void CPlayer::FireWeapon()
{
	// use camera->lookAt vector and multiply
	// this lookAt vector by the ammo's speed
	// to get the ammo velocity vector.
	// create the new ammo and attach it to
	// the world. fire the ammo

	CRocket *newRocket = new CRocket;

	newRocket->pitch = camera->pitch;
	newRocket->direction = direction;
	newRocket->position = position;
	newRocket->forward = camera->lookAt.UnitVector();
// Phase 19 - Uncomment the following
#ifdef ENABLE_SOUND 
	newRocket->SetAudioSystem(audioSys);
	newRocket->LoadAudio(audioSys->iExplode);
#endif
	newRocket->AttachTo(terrain);
}

// update player
void CPlayer::Tick()
{
	// keep the player with the camera
	position.y = camera->position.y;

// End - Phase 18

}

void CPlayer::init()
{
	kills = 0;
	playerDead = false;
}

void CPlayer::killPlayer()
{
	playerDead = true;
}

bool CPlayer::isPlayerDead()
{
	return playerDead;
}